package operation;

import book.BookLise;

import java.util.Scanner;

public class RetuenOperation implements IOperation {
    @Override
    public void work(BookLise bookLise) {
        System.out.println("归还图书");

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你要还的书的名字");
        String name = scanner.nextLine();

        for (int i = 0; i < bookLise.getNowSize(); i++) {

            if(name.equals(bookLise.getBooks(i).getName())){

                if(bookLise.getBooks(i).getisIfBorrowed() == true) {
                    bookLise.getBooks(i).setIfBorrowed(false);
                    System.out.println("成功归还");
                    return;
                }
            }
        }

        System.out.println("未找到");
    }
}

